package create_share

import (
	"clouds.lgb24kcs.cn/controllers/share/request"
	"clouds.lgb24kcs.cn/errorx"
	"clouds.lgb24kcs.cn/services/share"
	"clouds.lgb24kcs.cn/utils"
	"github.com/gin-gonic/gin"
)

// @Summary  创建文件分享
// @Success 200 {string} string json{"code","message"}
// @Param Authorization	header string true "Bearer 31a165baebe6dec616b1f8f3207b4273"
// @Param data body request.ShareCreateReq{} true "添加请求参数"
// @Router  /share/v1/create_share  [post]
// @version 1.0
func CreateShare(c *gin.Context) {
	req := request.ShareCreateReq{}
	if err := c.ShouldBindJSON(&req); err != nil {
		utils.Fail(c, errorx.VerifyError, err.Error())
	} else {
		userId := utils.CtxUserId(c)
		api := share.ShareAPI
		api.Create(c, req, userId)
	}
}
